<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="path" value="${pageContext.request.contextPath}" />
<!DOCTYPE HTML>
<html>
<jsp:include page="../../common/head.jsp"></jsp:include>
<body>
	<article class="page-container">
		<form id="form-student-add" action="${path}/student/update" method="post"
			class="form form-horizontal">
						<input type="hidden" name="id" value="${student.id}">
						<div class="row cl">
							<label class="form-label col-xs-4 col-sm-3"><span
								class="c-red">*</span>学号：</label>
							<div class="formControls col-xs-8 col-sm-9">
								<input type="text" class="input-text" value="${student.orderNo}" placeholder="学号"
									id="orderNo" name="orderNo">
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-xs-4 col-sm-3"><span
								class="c-red">*</span>姓名：</label>
							<div class="formControls col-xs-8 col-sm-9">
								<input type="text" class="input-text" value="${student.name}" placeholder="姓名"
									id="name" name="name">
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-xs-4 col-sm-3"><span
								class="c-red">*</span>性别:</label>
							<div class="formControls col-xs-8 col-sm-9 skin-minimal">
								<div class="radio-box">
									<input name="sex" value="01" type="radio">
									<label for="sex-1">男</label>
								</div>
								<div class="radio-box">
									<input name="sex" value="02" type="radio">
									<label for="sex-2">女</label>
								</div>
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-xs-4 col-sm-3"><span
								class="c-red">*</span>专业:</label>
							<div class="formControls col-xs-8 col-sm-9">
								<select class="select" size="1" name="major" id="major">
									<option value="">请选择专业</option>
									<option value="01">计算机</option>
									<option value="02">软件工程</option>
								</select>
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-xs-4 col-sm-3"><span
								class="c-red">*</span>出生日期：</label>
							<div class="formControls col-xs-8 col-sm-9">
								<input type="text" class="input-text" value="${student.birthday}" placeholder="出生日期"
									id="birthday" name="birthday">
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-xs-4 col-sm-3"><span
								class="c-red">*</span>总学分：</label>
							<div class="formControls col-xs-8 col-sm-9">
								<input type="text" class="input-text" value="${student.totalCredit}" placeholder="总学分"
									id="totalCredit" name="totalCredit">
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-xs-4 col-sm-3"><span
								class="c-red">*</span>备注：</label>
							<div class="formControls col-xs-8 col-sm-9">
								<input type="text" class="input-text" value="${student.remark}" placeholder="备注"
									id="remark" name="remark">
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-xs-4 col-sm-3"><span
								class="c-red">*</span>照片：</label>
							<div class="formControls col-xs-8 col-sm-9">
								<input type="text" class="input-text" value="${student.imgPath}" placeholder="照片"
									id="imgPath" name="imgPath">
							</div>
						</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
					<input class="btn btn-primary radius" type="submit"
						value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
				</div>
			</div>
		</form>
	</article>
	<jsp:include page="../../common/foot.jsp"></jsp:include>

	<script type="text/javascript">
		$(function() {
			$('input[name="sex"][value="${student.sex}"]').attr("checked",'checked'); 
			$('#major').find('option[value="${student.major}"]').attr("selected",'selected'); 
			$("#form-student-add").validate({
				rules : {
							orderNo:{
								required : true
							},
							name:{
								required : true
							},
							sex:{
								required : true
							},
							major:{
								required : true
							},
							totalCredit:{
								required : true
							}
				},
				onkeyup : false,
				focusCleanup : true,
				success : "valid",
				submitHandler : function(form) {
					var $form=$(form);
					$.post($form.attr('action'),$form.serialize(),function(result){
						if(checkCode(result)){
							var index = parent.layer.getFrameIndex(window.name);
							parent.layer.msg('修改成功', {
								  icon: 1,
								  time:1000 
							});
							parent.reload();
							parent.layer.close(index);
						}
					},'json').error(function(){
						serverError();
					});
				}
			});
		});
	</script>
</body>
</html>